package 并发编程13.中断方式;

import java.util.concurrent.locks.LockSupport;

/**
 * @author idea
 * @data 2019/2/1
 */
public class Demo1 {

    public static void main(String[] args) throws Exception {
        TestThread thread = new TestThread();
        thread.start();
        try {
            Thread.sleep( 1000 );
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread.interrupt();
        thread.isInterrupted();
        System.out.println(Thread.currentThread().isInterrupted());
    }

}

class TestThread extends Thread {

    @Override
    public void run() {
        System.out.println( Thread.currentThread().isInterrupted() );
//        LockSupport.park();
        System.out.println( Thread.currentThread().isInterrupted() );
    }
}

